package com.guldan.core.enums;

/**
 * Created by Silas.
 * Date: 2017/1/14
 * Time: 17:55
 */
public enum GRoleTypeEn {

    Admin("00", "管理员"),
    TownsEntry("01", "乡镇录入"),
    TownsReview("02", "乡镇复核"),
    Org("03", "主管部门"),
    Finance("04", "财政"),
    unknow("-1", "未知");

    private String code;
    private String mean;

    GRoleTypeEn(String code, String mean) {
        this.code = code;
        this.mean = mean;
    }

    public static GRoleTypeEn toEnum(Integer code) {
        GRoleTypeEn[] values = values();
        for (GRoleTypeEn en : values) {
            if (en.getCode().equals(code)) {
                return en;
            }
        }
        return unknow;
    }

    public String getCode() {
        return code;
    }

    public String getMean() {
        return mean;
    }

    //判断是否是乡镇录入人员帐号
    public boolean isTowns(String code) {
        if (code.equals(TownsEntry.getCode()) || code.equals(TownsReview.getCode())) {
            return true;
        }
        return false;
    }

}
